home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / OS / FWOSMisc / Include / FWCursor.h < prev    next >
Encoding:
Text File  |  1995-11-08  |  4.6 KB  |  176 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWCursor.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    © 1993, 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #if !defined(FWCURSOR_H) && !defined(__ODFRC__)
  11. #define FWCURSOR_H
  12.  
  13. #ifndef FWAUTODE_H
  14. #include "FWAutoDe.h"
  15. #endif
  16.  
  17. #ifndef FWSTDDEF_H
  18. #include "FWStdDef.h"
  19. #endif
  20.  
  21. #if defined FW_BUILD_MAC  && !defined __QUICKDRAW__
  22. #include <QuickDraw.h>
  23. #endif
  24.  
  25. #if defined FW_BUILD_MAC  && !defined __TOOLUTILS__
  26. #include <ToolUtils.h>
  27. #endif
  28.  
  29. #if defined FW_BUILD_WIN  && !defined __INC_WINDOWS
  30. #include <windows.h>
  31. #endif
  32.  
  33. #if FW_LIB_EXPORT_PRAGMAS
  34. #pragma lib_export on
  35. #endif
  36.  
  37. //========================================================================================
  38. //    Forward Class Declarations
  39. //========================================================================================
  40.  
  41. class FW_CLASS_ATTR FW_CResourceFile;
  42. class FW_CLASS_ATTR FW_CCursor;
  43.  
  44. //========================================================================================
  45. //  Type definitions
  46. //========================================================================================
  47. #ifdef FW_BUILD_WIN
  48. typedef HCURSOR         FW_PlatformCursorHandle;
  49. typedef LPCSTR            FW_SystemCursorID;
  50. #endif
  51.  
  52. #ifdef FW_BUILD_MAC
  53. typedef CursHandle         FW_PlatformCursorHandle;
  54. typedef FW_ResourceId    FW_SystemCursorID;
  55. #endif
  56.  
  57. //========================================================================================
  58. //  Globals
  59. //========================================================================================
  60.  
  61. extern FW_CCursor FW_gArrowCursor;
  62. extern FW_CCursor FW_gIBeamCursor;
  63. extern FW_CCursor FW_gCrossHairCursor;
  64. extern FW_CCursor FW_gWaitCursor;
  65. extern FW_CCursor FW_gOpenHandCursor;
  66. extern FW_CCursor FW_gClosedHandCursor;
  67. extern FW_CCursor FW_gSizeWECursor;        
  68. extern FW_CCursor FW_gSizeNSCursor;        
  69. extern FW_CCursor FW_gSizeNWSECursor;        
  70. extern FW_CCursor FW_gSizeNESWCursor;        
  71.  
  72. //========================================================================================
  73. //    FW_CCursor
  74. //========================================================================================
  75.  
  76. class FW_CLASS_ATTR FW_CCursor FW_AUTO_DESTRUCT_OBJECT
  77. {    
  78.  
  79. //----------------------------------------------------------------------------------------
  80. //    Constructor/Destructor
  81. //
  82. public:
  83.     FW_CCursor();
  84.         // Create an arrow cursor
  85.  
  86. #ifdef FW_BUILD_WIN        
  87.     FW_CCursor(FW_SystemCursorID systemCursorId);
  88.         // loads a standart cursor from the system file (differed)
  89. #endif        
  90.  
  91.     FW_CCursor(FW_ResourceId resourceId, FW_Boolean fromSystem = FALSE);
  92.         // loads a standart cursor from the system or this library (differed)
  93.     
  94.     FW_CCursor(FW_CResourceFile& resourceFile, FW_ResourceId resourceId);
  95.         // Load a cursor from a file (immediate)
  96.         
  97.     virtual~ FW_CCursor();
  98.  
  99. //----------------------------------------------------------------------------------------
  100. //    New API
  101. //
  102. public:    
  103.     static void Show();
  104.     static void Hide();
  105.     void Select() const;
  106.  
  107.     FW_PlatformCursorHandle GetHandle() const;
  108.         
  109. protected:
  110.     void    PrivLoadSystemCursor(FW_SystemCursorID systemCursorId);
  111.     void    PrivLoadCursor(FW_CResourceFile& resourceFile,
  112.                                    FW_ResourceId resId);
  113.     void    PrivDeferredLoad();
  114.     
  115. private:
  116.     FW_CCursor(const FW_CCursor& other);
  117.     FW_CCursor& operator=(const FW_CCursor& other);
  118.         // Copy constructor and assignment operator not valid for this class.    
  119.  
  120. //----------------------------------------------------------------------------------------
  121. //    New API
  122. //
  123. private:
  124.     FW_PlatformCursorHandle fCursorHandle;
  125.     
  126.     FW_Boolean                fDeferred;                // loaded only at Select
  127.     FW_Boolean                fFromSystem;            
  128.     
  129. #ifdef FW_BUILD_WIN
  130.     FW_ResourceId            fCursorID;
  131.     FW_SystemCursorID        fSystemCursorID;
  132. #endif
  133.         
  134. #ifdef FW_BUILD_MAC
  135.     FW_Boolean                 fMacIsColor;
  136.     FW_ResourceId            fCursorID;
  137. #endif
  138. };
  139.  
  140. //----------------------------------------------------------------------------------------
  141. //    FW_CCursor::Show
  142. //----------------------------------------------------------------------------------------
  143. inline void FW_CCursor::Show()
  144. {
  145. #ifdef FW_BUILD_MAC
  146.     ::ShowCursor();
  147. #endif
  148.  
  149. #ifdef FW_BUILD_WIN
  150.     ::ShowCursor(TRUE);
  151. #endif
  152.  
  153. }
  154.  
  155. //----------------------------------------------------------------------------------------
  156. //    FW_CCursor::Hide
  157. //----------------------------------------------------------------------------------------
  158. inline void FW_CCursor::Hide()
  159. {
  160. #ifdef FW_BUILD_MAC
  161.     ::HideCursor();
  162. #endif
  163.  
  164. #ifdef FW_BUILD_WIN
  165.     ::ShowCursor(FALSE);
  166. #endif
  167. }
  168.  
  169. #if FW_LIB_EXPORT_PRAGMAS
  170. #pragma lib_export off
  171. #endif
  172.  
  173. #endif
  174.  
  175.  
  176.